<template>
<div class="idshow-wrapper" v-if="info">
    <span v-show="false">
        {{b=col.auths?col.auths.contains(info.menu_id):false}}
          {{check=col.is_admin||b}}
    </span>
  <span v-if="check">
      <router-link v-if="col.rs" :to="{path:'/page/list',query:{ctl:col.ctl,id:col.rs}}">{{info.name}}</router-link>
    </span>
    <span v-else>{{info.name}}</span>
</div>
</template>
<script>
import tool from 'src/util/tool';
import util from '_util/index';


export default {
  data() {
    return {
      info: null,
    }
  },
  watch: {
    col: function() {
      this.setInfo();
    }
  },
  methods: {

    setInfo() {
        let id = this.col.rs;
        if(!id)
            return;
      let ctl = this.col.ctl
      // let current_fields = this.$store.state.global.current_fields;
      let current_names = this.$store.state.global.current_names;
      let info = '';
      if(current_names&&current_names[ctl]) {
          let [namesObj,menu_id] = current_names[ctl];
//          name = current_names[ctl][id] || `ID:${id}`
          let name = namesObj[id] || `ID:${id}`;
          info = {
              name,
              menu_id
          };
      }


      this.info= info;
    }
  },
  props: ['col'],
  computed: {
  },
  created() {
    this.setInfo();
  }
};
</script>
<style rel="stylesheet/less" lang="less">@dir: "cell/";</style>
